var app = angular.module(setting.appName);
app.register.controller("UserUnbindwxCtrl", ["$rootScope", "$scope", "$location", "$timeout", "$window", "ToastMessage", "SecurityService", "StockService", function($rootScope, $scope, $location, $timeout, $window, ToastMessage, SecurityService, StockService) {
    $scope.totalAsserts = 0,
    $scope.status = SecurityService.cache("status");
    var funs = {
        loadStatus: function() {
            SecurityService.status(function(data) {
                if (data && data.success) {
                    $scope.status = data.result;
                    var headImg = $rootScope.formatImgUrl($scope.status.credential.headimg);
                    headImg && $(".L_user_pic").attr("src", headImg)
                }
            })
        }
    };
    $scope.unbindWx = function(event) {
        app.util.setDisabled(event.target),
        app.util.loading(event.target, !0),
        SecurityService.wexinUnbind({
            password: $scope.password
        }).success(function(data) {
            ToastMessage.show(data.message, data.success),
            data && data.success && $timeout(function() {
                $window.history.back()
            }, 100),
            app.util.setEnabled(event.target),
            app.util.loading(event.target, !1)
        })
    }
    ,
    funs.loadStatus()
}
]);
